<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page pageEncoding="UTF-8"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link href="${ctx}/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="${ctx}/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>后台登录</title>
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
  <div id="loginform" class="loginBox">
    <form id="myform" class="form form-horizontal" action="${ctx}/login" method="post">
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-xs-8">
          <input id="userName" name="userName" type="text" placeholder="账户" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-xs-8">
          <input id="password" name="password" type="password" placeholder="密码" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input name="captcha" class="input-text size-L" type="text" placeholder="验证码"  id="code" style="width:150px;">
          <img src="${ctx}/servlet/validateCodeServlet"  style="height: 41px;"  id="captcha"	onclick="$('#kanbuq').click();" > <a id="kanbuq" href="javascript:;"  onclick="$('#captcha').attr('src','${pageContext.request.contextPath}/servlet/validateCodeServlet?'+new Date().getTime());" >看不清，换一张</a> </div>
      </div>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="online">
            <input type="checkbox" name="rememberMe" id="rememberMe" value="true">
            使我保持登录状态（公共场所慎用）</label>
        </div>
      </div>
      <c:if test="${error != '' && error != null}">
      <div >
        <div class="formControls col-xs-8 col-xs-offset-3">
          <label for="error"><font color="red">${error }</font></label>
        </div>
      </div>
      </c:if>
      <div class="row cl">
        <div class="formControls col-xs-8 col-xs-offset-3">
          <input name="" type="button" class="btn btn-success radius size-L"	   id="mybutton"	 value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
          <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
<div class="footer">Copyright 你的公司名称</div>
<script type="text/javascript" src="${ctx}/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${ctx}/lib/layer/2.4/layer.js"></script> 
<script type="text/javascript" src="${ctx}/static/h-ui/js/H-ui.min.js"></script>
<script>
$(document).ready(function() {
	var u = true;
	var p = true;
	var c = true;
	$('#userName').blur(function() {
		var t = $(this).val()
		if(t== "" || t== null){
			layer.tips('请输入用户名', '#userName', {
				  tips: [1,'#78BA32']
			});
			u = false;
		}else{
			u = true;
		}
	}); 
	
	$('#password').blur(function() {
		var t = $(this).val()
		if(t== "" || t== null){
			layer.tips('请输入密码', '#password', {
				  tips: [2,'#78BA32']
			});
			p = false;
		}else{
			p = true;
		}
	}); 
	
	$('#code').blur(function() {
		var t = $(this).val()
		if(t== "" || t== null){
			layer.tips('请输入验证码', '#code', {
				  tips: [4,'#78BA32']
			});
			c = false;
		}else{
			c= true;
		}
	}); 
	
	$('#mybutton').click(function(){
		if($('#userName').val() == ''){
			$('#userName').blur();
			return;
		}
		if($('#password').val() == ''){
			$('#password').blur();
			return;
		}
		if($('#code').val() == ''){
			$('#code').blur();
			return;
		}
		$.ajax({
			'url':'${ctx}/servlet/validateCodeServlet',
			'type':'GET',
			'data':{'validateCode':$('#code').val()},
			'success':function(data){
				if(data=='false'){
					layer.tips('验证码不正确', '#code', {
						  tips: [4,'#78BA32']
					});
					return;
				}else{
					$('#myform').submit();
				}
			}
		});
		
	});
});
</script>
</body>
</html>